import { connect } from 'react-redux';
import list from '../component/List';
import { delete_todo_item, check_box_handler, census_check_num } from '../store/actionCreator';

const mapStateToProps = (state, ownProps) => {
    return {
        list: state.list
    }
}
const mapDispatchToProps = (dispatch, ownProps) => {
    return {
        checkboxHandler: (index) => {
            dispatch(check_box_handler(index));
            dispatch(census_check_num());
        },
        deleteTodoItem: (index) => {
            dispatch(delete_todo_item(index));
            dispatch(census_check_num());
        }
    }
}

const listItem = connect(
    mapStateToProps,
    mapDispatchToProps
)(list)
export default listItem;